#ifndef _TREE0_H
#define _TREE0_H

#include "common.h"

#define MAX_TSIZE 16
typedef struct{
	/*
	char petname[20];
	char petkind[20];
	*/
	int data;
}Item;
typedef void (*Pfun)(Item item);

typedef struct node{
	Item item;
	struct node *left;
	struct node *right;
}Node;

typedef struct{
	Node *root;
	int size;
}Tree;

void createTree(Tree *ptree);
BOOL treeIsEmpty(const Tree *ptree);
BOOL treeIsFull(const Tree *ptree);
int treeCount(const Tree *ptree);
BOOL treeAddItem(const Item *pitem,Tree *ptree);
BOOL inTree(const Item *pitem,Tree *ptree);
void traverse_tree(const Tree *ptree,Pfun fun);
BOOL deleteItem(const Item *pitem,Tree *ptree);
void deleteAll(Tree *ptree);

#endif //#ifndef _TREE_H

